package nxu.it.movieapi.service.impl;

import nxu.it.api.model.Comment;
import nxu.it.movieapi.service.UserCommentService;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

@Component
public class UserCommentServiceImpl implements UserCommentService {

    // 模拟数据库存储
    private final List<Comment> commentRepository = new ArrayList<>();

    @Override
    public List<Comment> getCommentsByUserId(String userId) {
        return commentRepository.stream()
                .filter(comment -> comment.getUserId().equals(userId))
                .collect(Collectors.toList());
    }
}
